<?php $this->load->view('layout/lottery/header') ?>
<div class="lotteryMain">
	<div class="panel panel-default">
		<div class="panel-heading">活动列表 LIST OF DRAWING ACTIVITIES</div>
		<div class="panel-body">
	  		<form class="form-horizontal form-search" action="<?php echo site_url('lottery/index'); ?>" method="get">
	  			<div class="clearfix form-text">
					<div class="form-group clearfix">
					    <label class="control-label">活动名称</label>
					    <input type="text" class="form-control txt" placeholder="抽奖活动名称" name="lottery_name" value="<?php echo $this->input->get('lottery_name'); ?>" laydate({elem:'#start-date',istime: true})>
					</div>
					<div class="form-group clearfix">
					    <label class="control-label">上下架</label>
					    <select class="txt" name="status">
					    	<option value="0">全部</option>
					    	<option value="1" <?php echo (1 == $this->input->get('status')) ? 'selected="selected"' : ''; ?>>上架</option>
					    	<option value="2" <?php echo (2 == $this->input->get('status')) ? 'selected="selected"' : ''; ?>>下架</option>
					    </select>
					</div>
				</div>
				
				<div class="clearfix form-btns">
					<input type="submit" value="搜索" class="btn btn-submit" />
					<input type="reset" value="重置条件" class="btn btn-gray" />
				</div>
			</form>
		</div>
	</div>

	<div class="lotteryList">
		<div class="caption clearfix">
			<a href="<?php echo site_url('lottery/addLottery'); ?>" class="btn btn-add"><span>+</span>添加活动</a>
		</div>
		<?php if ($all_rows > 0) : ?>
		<table class="table table-striped mytable-striped">
			<thead>
				<tr>
					<th width="60">编号</th>
					<th>抽奖活动名称</th>
					<th width="100">可抽奖次数</th>
					<th width="100">可中奖几次</th>
					<th width="100">审核状态</th>
					<th width="100">活动状态</th>
					<th width="120">创建时间</th>
					<th width="310">操作</th>
				</tr>
			</thead>
			<tbody>
				<?php foreach ($page_list->result() as $item) : ?>
				<tr>
					<td><?php echo $item->lottery_id; ?></td>
					<td><?php echo $item->lottery_name; ?></td>
					<td><?php echo $item->lottery_sum; ?></td>
					<td><?php echo $item->winning_num; ?></td>
					<td>
						<span class="blue">
							<?php 
								switch ($item->audit_state) {
									case 1:
										echo '审核中';
										break;
									case 2:
										echo '审核通过';
										break;
									case 3:
										echo '审核不通过';
										break;
									default:
										echo '其它';
										break;
								}
							?>
						</span>
					</td>
					<td>
						<span class="blue">
							<?php echo ($item->status == 1) ? '上架' : '下架'; ?>
						</span>
					</td>
					<td><?php echo $item->created_at; ?></td>
					<td>
						<div class="op">
							<a href="<?php echo site_url('lotteryprize/prizeList'), '?lottery_id=', $item->lottery_id; ?>" class="btn">奖品列表</a>
							<!-- <a href="<?php echo site_url('lottery/userParticipation'), '?lottery_id=', $item->lottery_id; ?>" class="btn">参与用户</a> -->
							<a href="<?php echo site_url('lottery/editLottery/'. $item->lottery_id); ?>" class="btn">编辑</a>
							<a class="btn btn-del" href="<?php echo site_url('lottery/deleteLottery/'. $item->lottery_id); ?>" onclick="return confirm('确定删除吗')">删除</a>
						</div>
					</td>
				</tr>
				<?php endforeach; ?>
			</tbody>
		</table>
		<?php $this->load->view('layout/pagination') ?>
		<?php else :?>
            <div class="no-data">
                <img src="skins/images/panda.jpg"/>
                <p>没有搜索到结果</p>
            </div>
        <?php endif;?>
	</div>
</div>
<?php $this->load->view('layout/lottery/footer') ?>
<?php $this->load->view('layout/lottery/message') ?>